Skip to content

fix(mcpx): callWithLedger honors operator-declared readOnlyTools (#6493) - #8390

Merged
dezren39 merged 1 commit into
mainfrom
queue/10982-6493-declared-readonly-ledger
Nov 11, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/10982-6493-declared-readonly-ledger

Conversation

@dezren39

@dezren39 dezren39 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Fixes #6493. Queue task 10982.

Problem

callWithLedger (pkgs/mcpx/internal/daemon/registry.go) classified post-dispatch failures using only the annotation-based toolReadOnly helper. It never consulted the operator's readOnlyTools declaration (declaredReadOnly in consumer.go), even though the write-policy gate and confirmDestructive already trust that declaration. A declared read-only tool that timed out after dispatch therefore recorded an unknown outcome (ErrUnknownOutcome) and blocked subsequent non-read-only calls to the server.

Fix

The unknown-outcome classification is now toolReadOnly(p, tool) || r.declaredReadOnly(server, tool) — the declaration is read from the requested server's view, the same name the call was made under, matching how the gate paths consult it. Annotation-only behaviour for undeclared tools is unchanged (the packet's scope boundary).

Regression test

TestCallWithLedgerHonorsDeclaredReadOnlyAfterDispatch (in write_policy_test.go) drives a genuinely post-dispatch failure against the fake MCP server: the pool is warmed through the real config Resolve path, then the unannotated slow tool is called with a 5s call context against a 30s sleep, so the request is dispatched and the failure arrives with no response.

Oracle, per the packet:

  • Declared read-only (readOnlyTools: [slow]): the call returns the raw timeout error — no ErrUnknownOutcome, and the ledger contains no record for the server.
  • Undeclared control (identical setup, no declaration): the call returns ErrUnknownOutcome and the ledger does contain the record.

Verification (laptop, this branch)

Per the packet, the source PR #6265 review thread is not replied to or resolved by this change.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

The post-dispatch unknown-outcome classification consulted only the annotation-based toolReadOnly helper, so a tool the operator declared read-only in readOnlyTools that timed out after dispatch recorded an unknown outcome and blocked later writes -- while the gate and confirmDestructive already trusted the same declaration. callWithLedger now classifies with toolReadOnly || declaredReadOnly(server, tool). Regression test TestCallWithLedgerHonorsDeclaredReadOnlyAfterDispatch drives a real post-dispatch failure against the fake MCP server (slow tool + call-context timeout): no ledger record for the declared tool, ErrUnknownOutcome + record for the undeclared control. Verified: passes with the fix, fails without it on the declared case; the write-policy suite passes.
@dezren39
dezren39 requested a review from a team as a code owner November 11, 2026 01:29
@coderabbitai

coderabbitai Bot commented Nov 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 13 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 98404df1-80e7-40b5-b2d9-c5a90cc34f98
Commits

Reviewing files that changed from the base of the PR and between 327e5de and aabd09b.

Files selected for processing: 2

  • pkgs/mcpx/internal/daemon/registry.go
  • pkgs/mcpx/internal/daemon/write_policy_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T01:31:15.097526Z aabd09b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39 dezren39 added queue/parked Queue task is parked (waiting on CI, time, or an event) status/parked Deliberately paused with a recorded resume condition labels Nov 11, 2026
@dezren39
dezren39 merged commit 62826f7 into main Nov 11, 2026
4 of 19 checks passed
@dezren39
dezren39 deleted the queue/10982-6493-declared-readonly-ledger branch November 11, 2026 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

queue/parked Queue task is parked (waiting on CI, time, or an event) status/parked Deliberately paused with a recorded resume condition

Projects

None yet

1 participant